<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-2-7
 * Time: 下午10:38
 */

class AjaxoddsmanageopController extends Controller{
    public function index() {

    }

    public function getUserHistoryBet(){
        $this->getSmarty ();
        require_once SERVICE . DS . 'admin' . DS . 'event' . DS . 'IboBet.class.php';
        $username = $_POST['useremail'];
        $IboBet = new IboBet($this->getDB () );
        $userHistoryBets = $IboBet->getUserHistoryBet($username);
        echo $userHistoryBets=json_encode($userHistoryBets);
    }

    public function getEventOddsHistory(){
        $this->getSmarty ();
        require_once SERVICE . DS . 'admin' . DS . 'event' . DS . 'IboEvent.class.php';
        $event_id = $_POST['event_id'];
        $event = new IboEvent($this->getDB () );
        $historyscores = $event->getEventOddsHistory($event_id);
        echo $historyscores=json_encode($historyscores);
    }

    public function getEventUserBet(){
        $this->getSmarty ();
        require_once SERVICE . DS . 'admin' . DS . 'event' . DS . 'IboEvent.class.php';
        $event_id = $_POST['event_id'];
        $event = new IboEvent($this->getDB () );
        $users = $event->getEventUserBet($event_id);
        echo $users=json_encode($users);
    }

    public function updateHistoryEventBet(){
        $this->getSmarty ();
        require_once SERVICE . DS . 'admin' . DS . 'event' . DS . 'IboEvent.class.php';
        $event_id = $_POST['event_id'];
        $event_result = $_POST['event_result'];
        $event = new IboEvent($this->getDB () );
        echo $event->upadteHistoryeventScore($event_result, $event_id);
    }
}

?>